package com.showsu.editor.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author edison
 */

@Getter
@AllArgsConstructor
public enum HistroyStatusEnum {

    Not_Started(0, "未开始"),
    Running(1, "进行中"),
    Complete(2, "结束"),
    Error(3, "异常"),
    All(-1, "全部状态"),
    ;

    /**
     * 状态码
     */
    final Integer code;

    /**
     * 状态描述
     */
    final String msg;

    public static HistroyStatusEnum getByCode(Integer code) {
        if(code==null){
            return HistroyStatusEnum.All;
        }
        for(HistroyStatusEnum originEnum : HistroyStatusEnum.values()) {
            if (originEnum.getCode().equals(code)) {
                return originEnum;
            }
        }
        return null;
    }
}
